<%@Page Language = "C#" Debug="true"  ValidateRequest="false"%> 
<%@ import Namespace="System.Xml" %>
<%@ import Namespace="System.Data.OleDb" %>
<script language="C#" runat="server"> 
    void Page_Load()
    {
        bool check = false;
        OleDbConnection SourceDb = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("chapter9.mdb") + ";");
        SourceDb.Open();
            
        OleDbCommand myOleDbCommand = new OleDbCommand("SELECT * from Users;", SourceDb);
            OleDbDataReader oleDbReader = myOleDbCommand.ExecuteReader();
            while (oleDbReader.Read())
            {

                if (Request.Form["UserName"] != null)
                {
                    if (Request.Form["UserName"] == oleDbReader["UserName"].ToString())
                    {
                        check = true;
                    }
                }
            }

            //clean up database connection
            SourceDb.Close();
            SourceDb.Dispose();
            Response.Write(check);
          
    }
</script>




 